package com.sdk.springbootdynamicschedule.dynamicone;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TaskController {
    @Autowired
    private DynamicScheduler scheduler;

    @PostMapping("/update-cron")
    public void updateCron(@RequestParam String newCron) {
        // 更新数据库/配置中心
        scheduler.setCronExpression(newCron);
    }
}
